﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace NormReference.Services
{
    public class Logger
    {
        public static Logger instance;

        private Logger()
        {
            
        }

        public static Logger getInstance()
        {
            if (instance == null)
            {
                instance = new Logger();
            }

            return instance;
        }

        public void printToLogFile(string message)
        {
            StreamWriter log;
            string logFilePath = "C:\\Documents and Settings\\Kyle Hawkins\\Desktop\\CAPSTONE-FINAL\\NormReferenceFiles\\logFileNorm.txt";
            if (!File.Exists(logFilePath))
            {
                log = new StreamWriter(logFilePath);
            }
            else
            {
                log = File.AppendText(logFilePath);
            }

            //Write to file
            log.WriteLine(DateTime.Now.ToShortTimeString() + " " + message);
            log.Close();
        }
    }
}